package com.briup.recognition.web.controller;

import com.briup.recognition.bean.Dataset;
import com.briup.recognition.service.IDatasetService;
import com.briup.recognition.utils.Message;
import com.briup.recognition.utils.MessageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: ldd
 * @Date: 2021/03/28/19:51
 * @Description:
 */
@RestController
@RequestMapping("dataset")
public class DatasetController {
    @Resource
    private IDatasetService datasetService;

    @GetMapping("query")
    public Message query(){
        List<Dataset> list = datasetService.query();
        return MessageUtil.success(list);
    }
    @PostMapping("saveOrUpdate")
    public Message saveOrUpdate(Dataset dataset){
        datasetService.saveOrUpdate(dataset);
        return MessageUtil.success("操作成功");
    }

    @DeleteMapping("deleteById")
    public Message deleteById(long id){
        datasetService.deleteById(id);
        return MessageUtil.success("删除成功");
    }
}
